<?php

namespace app\api\controller\order;

use app\api\model\supplier\InvoiceModel;
use app\Request;
use app\api\controller\Controller;




/**
 * 发票
 */
class Invoice extends Controller
{
    public function createData(Request $request)
    {
        $params = $request->param();
        $user = $this->getUser();
        $params['uid'] = $user['user_id'];
        InvoiceModel::createData($params);
        return $this->renderSuccess('操作成功');
    }

    public function listData()
    {
        $user = $this->getUser();
        $list = InvoiceModel::listAll(['uid' => $user['user_id']]);
        return $this->renderSuccess('', $list);
    }

    public function one(Request $request)
    {
        $params = $request->param();
        return $this->renderSuccess('', InvoiceModel::one($params));
    }

    public function updateData(Request $request)
    {
        $params = $request->param();
        InvoiceModel::update($params);
        return $this->renderSuccess('操作成功');
    }

    public function deleteData(Request $request)
    {
        $params = $request->param();
        InvoiceModel::deleteData(['id' => $params['id']]);
        return $this->renderSuccess('操作成功');
    }

}
